package org.ndx.jsg.input.adapter;

import java.io.File;

import org.apache.tika.metadata.Metadata;
import org.ndx.jsg.FileInfos;
import org.ndx.jsg.input.FileInfosBuilder;

public class BuilderAdapter implements FileInfosBuilder {

	@Override
	public FileInfos getFileInfo(File f, String relativePath, Metadata metadata) {
		if(matches(f, relativePath, metadata)) {
			return create(f, relativePath, metadata);
		}
		return null;
	}

	protected FileInfos create(File f, String relativePath, Metadata metadata) {
		return new FileInfosAdapter(f, relativePath, metadata);
	}

	protected boolean matches(File f, String relativePath, Metadata metadata) {
		return true;
	}

}
